home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libio / stdio / stdio.h < prev    next >
C/C++ Source or Header  |  1994-10-20  |  5KB  |  180 lines

  1. /* This is part of the iostream/stdio library, providing -*- C -*- I/O.
  2.    Define ANSI C stdio on top of C++ iostreams.
  3.    Copyright (C) 1991 Per Bothner.
  4.  
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9.  
  10.  
  11. This library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. Library General Public License for more details.
  15.  
  16. You should have received a copy of the GNU Library General Public
  17. License along with this library; if not, write to the Free
  18. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /*
  22.  *    ANSI Standard: 4.9 INPUT/OUTPUT <stdio.h>
  23.  */
  24.  
  25. #ifndef _STDIO_H
  26. #define _STDIO_H
  27. #define _STDIO_USES_IOSTREAM
  28.  
  29. #include <libio.h>
  30.  
  31. #ifndef NULL
  32. #ifdef __cplusplus
  33. #define NULL 0
  34. #else
  35. #define NULL (void*)0
  36. #endif
  37. #endif
  38.  
  39. #ifndef EOF
  40. #define EOF (-1)
  41. #endif
  42. #ifndef BUFSIZ
  43. #define BUFSIZ 1024
  44. #endif
  45.  
  46. #define _IOFBF 0 /* Fully buffered. */
  47. #define _IOLBF 1 /* Line buffered. */
  48. #define _IONBF 2 /* No buffering. */
  49.  
  50. #define SEEK_SET 0
  51. #define SEEK_CUR 1
  52. #define SEEK_END 2
  53.  
  54.  /* define size_t.  Crud in case <sys/types.h> has defined it. */
  55. #if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE)
  56. #if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h)
  57. #if !defined(_GCC_SIZE_T) && !defined(_SIZET_)
  58. #define _SIZE_T
  59. #define _T_SIZE_
  60. #define _T_SIZE
  61. #define __SIZE_T
  62. #define _SIZE_T_
  63. #define ___int_size_t_h
  64. #define _GCC_SIZE_T
  65. #define _SIZET_
  66. typedef _IO_size_t size_t;
  67. #endif
  68. #endif
  69. #endif
  70.  
  71. typedef struct _IO_FILE FILE;
  72. typedef _IO_fpos_t fpos_t;
  73.  
  74. #define FOPEN_MAX     _G_FOPEN_MAX
  75. #define FILENAME_MAX _G_FILENAME_MAX
  76. #define TMP_MAX 999 /* Only limited by filename length */
  77.  
  78. #define L_ctermid     9
  79. #define L_cuserid     9
  80. #define P_tmpdir      "/tmp"
  81. #define L_tmpnam      20
  82.  
  83. /* For use by debuggers. These are linked in if printf or fprintf are used. */
  84. extern FILE *stdin, *stdout, *stderr; /* TODO */
  85.  
  86. #define stdin _IO_stdin
  87. #define stdout _IO_stdout
  88. #define stderr _IO_stderr
  89.  
  90. #ifdef __cplusplus
  91. extern "C" {
  92. #endif
  93.  
  94. #ifndef __P
  95. #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
  96. #define __P(args) args
  97. #else
  98. #define __P(args) ()
  99. #endif
  100. #endif /*!__P*/
  101.  
  102. extern void clearerr __P((FILE*));
  103. extern int fclose __P((FILE*));
  104. extern int feof __P((FILE*));
  105. extern int ferror __P((FILE*));
  106. extern int fflush __P((FILE*));
  107. extern int fgetc __P((FILE *));
  108. extern int fgetpos __P((FILE* fp, fpos_t *pos));
  109. extern char* fgets __P((char*, int, FILE*));
  110. extern FILE* fopen __P((const char*, const char*));
  111. extern int fprintf __P((FILE*, const char* format, ...));
  112. extern int fputc __P((int, FILE*));
  113. extern int fputs __P((const char *str, FILE *fp));
  114. extern size_t fread __P((void*, size_t, size_t, FILE*));
  115. extern FILE* freopen __P((const char*, const char*, FILE*));
  116. extern int fscanf __P((FILE *fp, const char* format, ...));
  117. extern int fseek __P((FILE* fp, long int offset, int whence));
  118. extern int fsetpos __P((FILE* fp, const fpos_t *pos));
  119. extern long int ftell __P((FILE* fp));
  120. extern size_t fwrite __P((const void*, size_t, size_t, FILE*));
  121. extern int getc __P((FILE *));
  122. extern int getchar __P((void));
  123. extern char* gets __P((char*));
  124. extern void perror __P((const char *));
  125. extern int printf __P((const char* format, ...));
  126. extern int putc __P((int, FILE *));
  127. extern int putchar __P((int));
  128. extern int puts __P((const char *str));
  129. extern int remove __P((const char*));
  130. extern int rename __P((const char* _old, const char* _new));
  131. extern void rewind __P((FILE*));
  132. extern int scanf __P((const char* format, ...));
  133. extern void setbuf __P((FILE*, char*));
  134. extern void setlinebuf __P((FILE*));
  135. extern void setbuffer __P((FILE*, char*, int));
  136. extern int setvbuf __P((FILE*, char*, int mode, size_t size));
  137. extern int sprintf __P((char*, const char* format, ...));
  138. extern int sscanf __P((const char* string, const char* format, ...));
  139. extern FILE* tmpfile __P((void));
  140. extern char* tmpnam __P((char*));
  141. extern int ungetc __P((int c, FILE* fp));
  142. extern int vfprintf __P((FILE *fp, char const *fmt0, _G_va_list));
  143. extern int vprintf __P((char const *fmt, _G_va_list));
  144. extern int vsprintf __P((char* string, const char* format, _G_va_list));
  145.  
  146. #ifndef __STRICT_ANSI__
  147. extern int vfscanf __P((FILE*, const char *, _G_va_list));
  148. extern int vscanf __P((const char *, _G_va_list));
  149. extern int vsscanf __P((const char *, const char *, _G_va_list));
  150. #endif
  151.  
  152. #if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
  153. extern FILE *fdopen __P((int, const char *));
  154. extern int fileno __P((FILE*));
  155. extern FILE* popen __P((const char*, const char*));
  156. extern int pclose __P((FILE*));
  157. #endif
  158.  
  159. #ifdef __USE_GNU
  160. extern _IO_ssize_t getdelim __P ((char **, size_t *, int, FILE*));
  161. extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
  162.  
  163. extern int snprintf __P ((char *, size_t, const char *, ...));
  164. extern int vsnprintf __P ((char *, size_t, const char *, _G_va_list));
  165. #endif
  166.  
  167. extern int __underflow __P((struct _IO_FILE*));
  168. extern int __overflow __P((struct _IO_FILE*, int));
  169.  
  170. #define getc(fp) _IO_getc(fp)
  171. #define putc(c, fp) _IO_putc(c, fp)
  172. #define putchar(c) putc(c, stdout)
  173. #define getchar() getc(stdin)
  174.  
  175. #ifdef __cplusplus
  176. }
  177. #endif
  178.  
  179. #endif /*!_STDIO_H*/
  180.